/**
 * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
 */
package com.jeeplus.modules.web.mapper;

import java.sql.Timestamp;
import java.util.Date;
import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.jeeplus.core.persistence.BaseMapper;
import com.jeeplus.core.persistence.annotation.MyBatisMapper;
import com.jeeplus.modules.web.entity.WxAgents;
import com.jeeplus.modules.web.entity.WxOrder;
import com.jeeplus.modules.web.entity.WxOrders;

/**
 * 订单管理MAPPER接口
 *
 * @author rongjie
 * @version 2017-08-06
 */
@MyBatisMapper
public interface WxOrderMapper extends BaseMapper<WxOrder> {

	/**
	 * @param orderNumber
	 * @param id
	 * @param name
	 * @param type
	 * @param text
	 * @param money
	 * @param addOrderMoney
	 * @param equipment
	 * @param i
	 * @param timestamp
	 * @param equipmentMoney
	 *
	 * @return
	 */
	int addOrder(@Param("orderNumber") String orderNumber, @Param("id") String id, @Param("name") String name,
				 @Param("type") String type, @Param("text") String text, @Param("orderMoney") String money,
				 @Param("addOrderMoney") String addOrderMoney, @Param("equipment") String equipment, @Param("i") Integer i,
				 @Param("time") Date time, @Param("timestamp") Timestamp timestamp, @Param("equipmentMoney") Double equipmentMoney,
				 @Param("coupon") String coupon);

	WxOrder getOrder(String outTradeNo);

	Integer getLastOrder(@Param("userId")String userId,@Param("second")Integer second,@Param("type")Integer type,@Param("equipment")String equipment);

	WxOrders getOrderMap(String outTradeNo);

	int setOrder(@Param("outTradeNo") String outTradeNo, @Param("transaction_id") String transaction_id,
			@Param("i") int i, @Param("text") String text, @Param("msg") String msg);

	int addCommand(@Param("equipment") String equipment, @Param("orderNumber") String orderNumber,
			@Param("data") String data);

	WxOrder getTimeOrder(String id);

	Timestamp getTime(String number);

	List<WxOrder> getList(@Param("id")String id,@Param("start")Integer start,@Param("end")Integer end,@Param("status")List<Integer> status,@Param("deviceCode")String deviceCode);
	List<WxOrder> getListByid(@Param("id")String id);


	List<String> getListEquipment(String number);

	WxOrder getTypeOrder(String id);

	Integer setEquipment(@Param("equipment") String equipment, @Param("orderNumber") String orderNumber);

	@Select("select version from yj_equipment where number=#{mac} ")
	Integer getVersion(String mac);

	Integer setVersion(String mac);

	Integer setEndOrderTime(@Param("timestamp") Timestamp timestamp, @Param("i") int i,
			@Param("orderNumber") String orderNumber, @Param("orderMoney") Double orderMoney);

	Integer addComment(@Param("text") String text, @Param("purification") String purification,
			@Param("noise") String noise, @Param("light") String light, @Param("number") String number);

	Integer setOrderComment(String number);

	Integer getMoney(@Param("money") Double money, @Param("id") String id);

	Integer getOrderTime(String orderNumber);

	@Select("select order_money from wx_order where order_number=#{number}")
	Double getOrderMoney(String number);

	@Select("select money from yj_equipment where number=#{number}")
	Double getEquipmentMoney(String number);

	List<WxOrder> getRefunds();

	List<WxOrder> getLists(@Param("day") String day);

	Double getOrderTimeTotal(@Param("setTime") Timestamp setTime, @Param("timeEnd") Timestamp timeEnd,
			@Param("i") int i, @Param("wxAgents") WxAgents wxAgents);

	@Select("select number,set_time from yj_equipment where type=1")
	List<Map<String, Object>> getStop();

	List<WxOrder> getOrderByStatus(@Param("number") String number,@Param("status")Integer status);

	@Select("select hour from wx_combination where money=#{money} limit 1")
	Integer getCombinationTime(Double money);
}
